<template>
  <div>
    <div ref="myChart" class="radar-echart" />
  </div>
</template>

<script>
import * as echarts from 'echarts'
export default {
  mounted() {
    // 组件挂载完毕,
    // 渲染雷达图
    // 1. 初始化图表实例
    const myChart = echarts.init(this.$refs.myChart)
    // 2. 设置图表配置属性
    const option = {
      radar: {
        // shape: 'circle',
        name: {
          textStyle: {
            color: '#fff',
            backgroundColor: '#4979fa',
            borderRadius: 6,
            padding: [5, 8]
          }
        },
        indicator: [
          { name: '考勤', max: 6500 },
          { name: '新技术', max: 16000 },
          { name: '培训新人', max: 30000 },
          { name: '修复bug', max: 38000 },
          { name: '工作产出', max: 52000 },
          { name: '帮助同事', max: 25000 }
        ]
      },
      series: [{
        name: '预算 vs 开销（Budget vs spending）',
        type: 'radar',
        // areaStyle: {normal: {}},
        data: [
          {
            value: [4300, 10000, 28000, 35000, 50000, 19000],
            name: '预算分配（Allocated Budget）'
          },
          {
            value: [5000, 14000, 28000, 31000, 42000, 21000],
            name: '实际开销（Actual Spending）'
          },
          {
            value: [6000, 12300, 20000, 12200, 33000, 21000],
            name: '测试'
          }
        ]
      }]
    }
    // 挂载配置
    myChart.setOption(option)
  }
}
</script>

<style lang="scss" scoped>
.radar-echart {
    width: 600px;
    height: 400px;
}
</style>
